ROPDetect : Detection of Code Reuse Attacks
نویسندگان
چکیده
Software exploitation, as used by malware and other kinds of attacks, require the attacker to take control of code execution. Historically, this involves injecting code into memory and using a software vulnerability to execute it. This works because both ARM and x86 uses a modified Harvard architecture which allows code and data memory to be shared. ARMv6 introduced the “execute never”[1] feature and Intel introduced the “execute disable” feature with their “Prescott” processors[3]. Both of these implementations ensure that memory pages are never mapped as both writable and executable (unless specified explicitly by the OS). This mitigates code injection attacks that relies on redirecting execution to attacker-controlled code stored in data memory. In response to this, attackers rely on “code reuse” or “return orientated programming” (ROP). The idea behind ROP is that the attacker cannot map her own code into the target’s executable memory, but she can “reuse” the code already in executable memory as well as control the target’s program stack (through some vulnerability). The program stack is typically used to store (along with other data), return pointers when a function call is made. The return pointer allows the program to resume execution at the caller after a function call returns. When the attacker overwrites the return pointer, she can redirect control flow to anywhere in executable memory. If the attacker finds useful “gadgets”, or instructions that perform a single useful operation (such as a memory load or store) and then jumps to the next return pointer in the stack, she can inject a large number of return pointers into the stack and control execution that way. Even though ROP attacks are very powerful, most attackers only use it as the first stage of a multi-stage attack where ROP is used to bypass operating system restrictions in order to escalate control of the compromised process to control of the entire system. If we can differentiate ROP execution with normal code execution, then we can terminate a process before the control is escalated and stop the attack. Heuristically, we can see that ROP execution is different because it uses a large number of “return” instructions while normal (optimized) code does not perform as many returns in the same sort period of time. Additionally, in normal code, “return” instructions are often matched with “call” instructions. Finally, processors optimized to run normal code will likely perform better with normal execution than ROP execution (which for example, makes branch prediction hard). However, even in normal execution, there are situations such as tail recursion in a tight function that may make classification using just heuristics difficult. We choose to implement unsupervised machine learning to solve the classification problem.
منابع مشابه
Dwarf Frankenstein is still in your memory: tiny code reuse attacks
Code reuse attacks such as return oriented programming and jump oriented programming are the most popular exploitation methods among attackers. A large number of practical and non-practical defenses are proposed that differ in their overhead, the source code requirement, detection rate and implementation dependencies. However, a usual aspect among these methods is consideration of the common be...
متن کاملAggrandizing the beast's limbs: patulous code reuse attack on ARM architecture
Since smartphones are usually personal devices full of private information, they are a popular target for a vast variety of real-world attacks such as Code Reuse Attack (CRA). CRAs enable attackers to execute any arbitrary algorithm on a device without injecting an executable code. Since the standard platform for mobile devices is ARM architecture, we concentrate on available ARM-based CRAs. Cu...
متن کاملDetecting Code Reuse Attacks with a Model of Conformant Program Execution
Code reuse attacks circumvent traditional program protection mechanisms such as W ⊕ X by constructing exploits from code already present within a process. Existing techniques to defend against these attacks provide ad hoc solutions or lack in features necessary to provide comprehensive and adoptable solutions. We present a systematic approach based on first principles for the efficient, robust ...
متن کاملXede: Practical Exploit Early Detection
Code reuse and code injection attacks have become the popular techniques for advanced persistent threat (APT) to bypass exploit-mitigation mechanisms deployed in modern operating systems. Meanwhile, complex, benign programs such as Microsoft Office employ many advanced techniques to improve the performance. Code execution patterns generated by these techniques are surprisingly similar to exploi...
متن کاملSide channel parameter characteristics of code injection attacks
Embedded systems are suggestive targets for code injection attacks in the recent years. Software protection mechanisms, and in general computers, are not usually applicable in embedded systems since they have limited resources like memory and process power. In this paper we investigate side channel characteristics of embedded systems and their applicability in code injection attack detection. T...
متن کامل